<template>
  <div>
    <Header></Header>
    <!-- <TaskList v-if="isLogin"></TaskList> -->
    <HomePage v-if="isLogin"></HomePage>
  </div>
</template>

<script>
import Header from "@/components/Header";
import TaskList from "@/components/TaskList";
import HomePage from "@/components/HomePage";
export default {
  name: "Home",
  components: { Header, TaskList, HomePage },
  data() {
    return {
      isLogin: false
    };
  },
  created() {
    this.login()
  },
  methods: {
    // 登录
    login() {
      let username = this.$route.query.userName ? this.$route.query.userName : 'admin';
      this.axios.userLogin({
        userName: username
      }).then((res) => {
        if (res.code == 200) {
          this.isLogin = true
        }
      }).catch(function (error) {});
    },
  },
};
</script>